import 'package:flutter/material.dart';
import 'package:logger/logger.dart';

import 'ImageDemo.dart';
import 'animation_demo.dart';

class Homedemo extends StatefulWidget {
  const Homedemo({super.key});

  @override
  State<Homedemo> createState() => _ImagedemoState();
}

class _ImagedemoState extends State<Homedemo> {
  @override
  Widget build(BuildContext context) {
    return Wrap(
      spacing: 8,
      runSpacing: 6,
      children: [
        _chip("Image", Imagedemo()),
        _chip("Animation", AnimationDemo()),
      ],
    );
  }

  _chip(String label, Widget imagedemo) {
    return GestureDetector(
      onTap: () {
        Logger().i(label);
        Navigator.push(
            context, MaterialPageRoute(builder: (context) => imagedemo));
      },
      child: Chip(
        label: Text(label),
        avatar: CircleAvatar(
          backgroundColor: Colors.blue.shade900,
          child: Text(
            label.substring(0, 1),
            style: TextStyle(fontSize: 10),
          ),
        ),
      ),
    );
  }
}
